<?php
namespace Framework;
use Framework\Session;

class Authorisation {
    /**
     * Check if the session user is the owner of the resource.
     *
     * @param int $resourceId
     * @return bool
     */
    public static function isOwner($resourceId) {
        $sessionUser = Session::get('user');
        if ($sessionUser !== null && isset($sessionUser["id"])) {
            $sessionUserId = (int) $sessionUser['id'];
            return $sessionUserId === $resourceId;
        }
        return false;
    }
}